#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "Timer.h"
#include "Buzzer.h"

uint16_t num = 0;

int main(void)
{
	OLED_Init();
	OLED_ShowString(1, 1, "Num:");
	Buzzer_Init();
	Timer_Init();
	while (1)
	{
		if (num < 10)
		{
		OLED_ShowNum(1, 5, num, 5);
		}
		else
		{
			OLED_ShowNum(1, 5, 10, 5);
			Buzzer_BIBI();
		}
	}
}

void TIM2_IRQHandler(void)
{
    if (TIM_GetFlagStatus(TIM2, TIM_FLAG_Update) == SET)
    {
		num++;
        TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
    }
}

